package com.project.service;

import com.project.dao.TeacherInfoMapper;
import com.project.entity.TeacherInfo;
import com.project.myBeans.TeacherInfoDetail;
import com.project.service.base.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Transactional(rollbackFor = {Exception.class})
@Service
public class TeacherInfoServiceImpl extends BaseService implements TeacherInfoService{

    @Autowired
    TeacherInfoMapper teacherInfoMapper;

    @Override
    public TeacherInfo findById(Integer id) {
        return teacherInfoMapper.selectByPrimaryKey(id);
    }

    @Override
    public TeacherInfoDetail findDetailByTeacherId(Integer id) {
        return teacherInfoMapper.selectDetailByTeacherid(id);
    }

    @Override
    public TeacherInfo findByUserid(Integer userid) {
        return teacherInfoMapper.selectByUserid(userid);
    }

    @Override
    public void add(TeacherInfo teacherInfo) {
        teacherInfoMapper.insertSelective(teacherInfo);
    }

    @Override
    public List<TeacherInfo> findBySchoolId(Integer schoolid) {
        return teacherInfoMapper.selectBySchoolId(schoolid);
    }
}
